﻿using Mes.Domain.BoundedContext.Entities.WorkOrders;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mes.Infrastructure.Data.BoundedContext.EntityTypeConfigurations.WorkOrders
{
    public class JobEventEntityConfig : IEntityTypeConfiguration<JobEvent>
    {
        public void Configure(EntityTypeBuilder<JobEvent> builder)
        {
            builder.ToTable("job_event");
            builder.HasKey(b => b.Row_Id);
            builder.Property(b => b.Event_Time_Utc).IsRequired();
            builder.Property(b => b.Event_Time_Local).IsRequired();
            builder.Property(b => b.Wo_Id).HasMaxLength(40);
            builder.Property(b => b.Oper_Id).HasMaxLength(40);
            builder.Property(b => b.Step_No);
            builder.Property(b => b.Event_Type).HasMaxLength(40);
            builder.Property(b => b.Ent_Id);
            builder.Property(b => b.Bom_Pos);
            builder.Property(b => b.Lot_No).HasMaxLength(40);
            builder.Property(b => b.Sublot_No).HasMaxLength(40);
            builder.Property(b => b.Item_Id);
            builder.Property(b => b.Cert_Name).HasMaxLength(40);
            builder.Property(b => b.Done_By_User_Id).HasMaxLength(40);
            builder.Property(b => b.Checked_By_User_Id).HasMaxLength(40);
            builder.Property(b => b.Source_Row_Id);
            builder.Property(b => b.Spec_Id).HasMaxLength(40);
            builder.Property(b => b.Genealogy_Id).HasMaxLength(254);
            builder.Property(b => b.Segment_Requirement_Id).HasMaxLength(80);
            builder.Property(b => b.Segment_Response_Id).HasMaxLength(80);
            builder.Property(b => b.Subsegment_Id).HasMaxLength(80);
            builder.Property(b => b.Quantity);
            builder.Property(b => b.Comments).HasMaxLength(254);
            builder.Property(b => b.Value1).HasMaxLength(80);
            builder.Property(b => b.Value2).HasMaxLength(80);
            builder.Property(b => b.Value3).HasMaxLength(80);
            builder.Property(b => b.Value4).HasMaxLength(80);
            builder.Property(b => b.Value5).HasMaxLength(80);
            builder.Property(b => b.Value6).HasMaxLength(80);
            builder.Property(b => b.Value7).HasMaxLength(80);
            builder.Property(b => b.Value8).HasMaxLength(80);
            builder.Property(b => b.Value9).HasMaxLength(80);
            builder.Property(b => b.Value10).HasMaxLength(80);
            builder.Property(b => b.Last_Edit_Comment).HasMaxLength(254);
            builder.Property(b => b.Last_Edit_By).HasMaxLength(40);
            builder.Property(b => b.Last_Edit_At).IsRequired();
            builder.Property(b => b.Row_Id).IsRequired().UseIdentityColumn().HasIdentityOptions(startValue: 0, incrementBy: 1, minValue: 0);
        }
    }
}
